package com.itboye.mengwu.app.ui.aizhiwu;

import android.annotation.SuppressLint;
import android.graphics.Color;
import android.graphics.Rect;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout.LayoutParams;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.itboye.core.object.BaseActivity;
import com.itboye.mengwu.R;

public class MengShiGuangDetailActivity extends BaseActivity{

	View headerView,footView;
	ListView listView;
	private MyAdapter adapter;
	@Override
	public int initView() {
		// TODO Auto-generated method stub
		return R.layout.activity_mengshiguangdetail;
	}

	@SuppressLint("NewApi") @Override
	public void onMyCreate() {
		if(VERSION.SDK_INT >= VERSION_CODES.KITKAT) {
            //透明状态栏
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            //透明导航栏
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
    }
		headerView=LayoutInflater.from(this).inflate(R.layout.item_mengshiguang_headview, null);
		listView.addHeaderView(headerView);
		footView= LayoutInflater.from(this).inflate(R.layout.item_mengshiguang_footview1, null);
		listView.addFooterView(footView);
		adapter=new MyAdapter();
		listView.setAdapter(adapter);
		
	}
	@Override
	public void onWindowFocusChanged(boolean hasFocus) {
		// TODO Auto-generated method stub
		super.onWindowFocusChanged(hasFocus);
        RelativeLayout.LayoutParams params=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT);
        params.setMargins(0, getStatusBarHeight(), 0, 0);
        findViewById(R.id.top).setLayoutParams(params);
	}
	
	
	public class MyAdapter extends BaseAdapter{

		@Override
		public int getCount() {
			// TODO Auto-generated method stub
			return 10;
		}

		@Override
		public Object getItem(int position) {
			// TODO Auto-generated method stub
			return null;
		}

		@Override
		public long getItemId(int position) {
			// TODO Auto-generated method stub
			return 0;
		}

		@Override
		public View getView(int position, View convertView, ViewGroup parent) {
			ViewHolder holder;;
			if(convertView==null){
				convertView=LayoutInflater.from(MengShiGuangDetailActivity.this).inflate(R.layout.item_mengshiguangdetail, null);
				holder=new ViewHolder();
				holder.textView=(TextView) convertView.findViewById(R.id.txt);
				holder.delete=(ImageView)convertView.findViewById(R.id.delete);	
				holder.datu=(ImageView) convertView.findViewById(R.id.image);
				convertView.setTag(holder);
			}else{
				convertView.getTag();
			}
//			holder.datu.se
			return convertView;
		}
		
		public class ViewHolder{
			TextView textView;
			ImageView delete;
			ImageView datu;
		}
		
	}

}
